package com.ctl.szmd.szmd.feature_wm.ui.fragment.pager1

import android.os.Bundle
import android.view.View
import androidx.navigation.fragment.findNavController
import com.bumptech.glide.Glide
import com.ctl.lib_common.extensions.singleClick
import com.ctl.szmd.szmd.feature_wm.R
import com.ctl.szmd.szmd.feature_wm.databinding.FragmentSubOrgDetailBinding
import com.ctl.szmd.szmd.feature_wm.ui.base.BaseWmBindingFragment
import kotlinx.android.synthetic.main.fragment_sub_org_detail.*
import kotlinx.android.synthetic.main.view_wm_tool_bar.*

class SubOrgDetailFragment : BaseWmBindingFragment<FragmentSubOrgDetailBinding>() {

    companion object {
        const val TITLE = "Title"
        const val BRIEF_INTRO = "BriefIntro"
        const val IMAGE_NET_PATH = "ImageNetPath"
    }

    override fun getLayoutId(): Int = R.layout.fragment_sub_org_detail

    override fun initView() {

        toolbar_title.text = "下属组织"
        toolbar_left.visibility = View.VISIBLE
        toolbar_left.singleClick {
            findNavController().navigateUp()
        }
        val title = arguments?.getString(TITLE)
        val brief_intro = arguments?.getString(BRIEF_INTRO)
        val image_net_path = arguments?.getString(IMAGE_NET_PATH)
        if (title != null) {
            toolbar_title.text = title
            txt_title.text = title
        }
        if (brief_intro != null) {
            txt_content.text = brief_intro
        }
        if (image_net_path != null) {
            Glide.with(requireContext()).load(image_net_path).into(img_item)
        }
    }

}